<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品信息编辑</title>
<#include "/WEB-INF/content/module-edit.html">
<script type="text/javascript">
var sysStatus = [
    {"id":"0","text":"正常"},
    {"id":"1","text":"禁用"}
];
var tickettype=[
    {"id":"0","text":"物流配送"},
    {"id":"1","text":"终端领取"}              
];
var typeTree=[
          	<#list map.typeTree as item>
          		{"id":"${item.id}","text":"${item.text}","children":[
          			<#list item.children as ite>
          				{"id":"${ite.id}","text":"${ite.text}"}<#if ite_has_next>,</#if>
          			</#list>
          		]}<#if item_has_next>,</#if>
          	</#list>
          ];
$(function() {
  	$("#status").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
  		data:sysStatus
  	}); 
  	$("#tickettype").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
  		required:true,
  		data:tickettype
  	});
  	$("#parent").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
        panelHeight:'auto',
  		data:typeTree,
  		onChange:function(data){
  			for(var i in typeTree){
  				if(typeTree[i].id==data){
  					$("#ttid").combobox({
  				  		valueField : 'id',
  				  		textField : 'text',
  				  		editable:false,
  				        panelHeight:'auto',
  				        value:"",
  				  		data:typeTree[i].children
  					});
  				}
  			}
  		}
  	});	  
    <#if object.tid?exists&&object.tid!="">
    var sub;
    var parent=$("#parent").val();
    for(var i in typeTree){
    	if(typeTree[i].id==parent){
    		sub=typeTree[i].children;
    	}
    }
	$("#ttid").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
        panelHeight:'auto',
        data:sub
	});    
	<#else>
	$("#ttid").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
        panelHeight:'auto',
	});        
	</#if>  
  	$("#denomination").numberbox({min:0,precision:2});
	$('#validdate').numberspinner({editable:true,min:1,increment:1 });
 });
</script>
<style>
.input-width{
	width: 95%;
}
</style>
 
</head>
<body class="easyui-layout">
	<div region="north" id="toolbar" style="background-color: #eee; padding: 5px; overflow: hidden;" border="false">
		<#if object.pid?exists&&object.pid!="">
			<@auth code="product:info:update">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:save()">保存</a>
			</@auth>
		<#else>
			<@auth code="product:info:create">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:save()">保存</a>
			</@auth>
		</#if>
		<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-edit" style="border: 1px solid #ccc" onclick="javascript:cancel()">关闭</a>
	</div>
	<div region="center">
		<div id="p" class="easyui-panel" style="background: #fafafa; padding: 10px" fit="true" toolbar="#toolbar">
			<form id="form" method="post">
				<input type="hidden" id="_id" name="tid" value="${object.tid!}"/>
				<table class="form" cellspacing="0" style="width: 100%">
					<tbody style="border: 1px solid #ccc">
						<tr>
							<td class="label">所属分类</td>
							<td><input id="parent" value="${map.typeparent!}"/><input id="ttid" name="ttid" value="${object.ttid!}"/></td>
							<td class="validate">*</td>
							<td class="label">票券名称</td>
							<td><input id="infoname" name="infoname" value="${object.infoname!}" class="easyui-validatebox" required="true"/></td>
							<td class="validate">*</td>							
						</tr>
						<tr>
							<td class="label">面额</td>
							<td><input id="denomination" name="denomination" value="${object.denomination!}" class="easyui-validatebox" required="true"/></td>
							<td class="validate">*</td>
							<td class="label">状态</td>			
							<td><input id="status" name="status" value="${object.status!0}"/></td>
							<td class="validate"></td>							
						</tr>
						<tr>
							<td class="label">票券描述</td>
							<td colspan="4"><textarea style="width:90%;" id="infointro" name="infointro" value="${object.infointro!}"></textarea></td>
							<td class="validate"></td>	
						</tr>
						<tr>
							<td class="label">开始时间</td>
							<td><input id="begintime" class="easyui-datetimebox" editable="false" name="begintime" value="${object.begintime!}"/></td>
							<td class="validate"></td>
							<td class="label">结束时间</td>
							<td><input id="endtime" class="easyui-datetimebox" editable="false" name="endtime" value="${object.endtime!}"/></td>
							<td class="validate"></td>							
						</tr>		
						<tr>
							<td class="label">票卷配送类型</td>
							<td><input id="tickettype" name="tickettype" value="${object.tickettype!0}"/></td>
							<td class="validate"></td>														
						</tr>											
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>